package com.lebang.model.enums;

/**
 * @Author: hwq
 * @Date: 2020/5/20 13:45
 * @Version 1.0
 */
public enum  CheckStatus {
    /**
     * 审核失败
     */
    FAIL("审核失败", -1),
    BUSS_CHECK("审核人员审核", 1),
    FIN_CHECK("财务人员审核",2),
    SUCCESS("已到账",3),
    ;

    private String title;
    private int index;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    private CheckStatus(String title, int index) {
        this.title = title;
        this.index = index;
    }

    public CheckStatus getByIndex(int index) {
        for (CheckStatus e : CheckStatus.values()) {
            if (e.index == index) {
                return e;
            }
        }
        return null;
    }

    public CheckStatus getByTitle(String title) {
        if (null == title) {
            return null;
        }
        for (CheckStatus e : CheckStatus.values()) {
            if (e.title.equals(title)) {
                return e;
            }
        }
        return null;
    }
}
